package org.ourgrid.broker.commands.executors;

import java.io.Reader;
import java.io.StringReader;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.ourgrid.broker.commands.SchedulerData;
import org.ourgrid.common.logger.NoOpEntityResolver;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;

import br.edu.ufcg.lsd.commune.container.servicemanager.ServiceManager;

public class SchedulerCommandExecutor implements ISchedulerCommandExecutor{

	public void execute(SchedulerData data, ServiceManager manager) {
	}
	
	protected Document getXMl(String xml) {
		
		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
		
		Document logDocFile = null;
		try {
			DocumentBuilder docBuilder = dbf.newDocumentBuilder();
			docBuilder.setEntityResolver(new NoOpEntityResolver());
			
			Reader reader = new StringReader(xml);
			InputSource s = new InputSource(reader);
			logDocFile = docBuilder.parse(s);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return logDocFile;
	}

}
